home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Grafik / Misc / ImageEnginer / ARexx / Bleed.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-07-14  |  2.5 KB  |  114 lines

  1. /* 
  2. ** $VER: Bleed 1.1, IE Arexx script
  3. ** Image Engineer Macro script
  4. ** © by Patrik M Nydensten 
  5. ** 12/7 1996 Stockholm/Sweden
  6. **
  7. ** Simulates TV color bleeding.
  8. */
  9.  
  10. Options results
  11. Signal on error            /* Setup a place for errors to go */
  12.  
  13. if arg()==0 then exit
  14.  
  15. ORIGINAL = arg(1)
  16.  
  17. 'PROJECT_INFO' arg(1) 'WIDTH'    /* Get width of image */
  18. IW = RESULT
  19. 'PROJECT_INFO' arg(1) 'HEIGHT'    /* Get height of image */
  20. IH = RESULT
  21.  
  22. 'REQUEST "Which color should bleed?" " Red | Green | Blue | All | Cancel "'
  23. if ((RC=5)|(RESULT=0)) then exit
  24. C = RESULT
  25.  
  26. select
  27.   when C = 1 then do ; BASE = RED ; XBASE = GREEN BLUE ; end
  28.   when C = 2 then do ; BASE = GREEN ; XBASE = RED BLUE ; end
  29.   when C = 3 then do ; BASE = BLUE ; XBASE = RED GREEN ; end
  30.   when C = 4 then do ; end
  31. end /* select */
  32.  
  33. 'GET_NUMBER "Select Bleed amount." 1 100 "  Go!  " 8'
  34. if RC=5 then exit 
  35. BLEED = RESULT
  36.  
  37. /* Process */
  38.  
  39. if C = 4 then do
  40.   BASE = RED ; XBASE = GREEN BLUE
  41.   RedImage = bleedfeed(ORIGINAL)
  42.  
  43.   BASE = GREEN ; XBASE = RED BLUE
  44.   GreenImage = bleedfeed(RedImage)
  45.   'CLOSE' RedImage
  46.  
  47.   BASE = BLUE ; XBASE = RED GREEN
  48.   BlueImage = bleedfeed(GreenImage)
  49.   'CLOSE' GreenImage
  50. end
  51. else OutImage = bleedfeed(ORIGINAL)
  52.  
  53. exit
  54.  
  55. /* Procedures */
  56.  
  57. BleedFeed:
  58.   parse arg INFEED
  59.   'BRIGHTNESS' INFEED '-255' XBASE
  60.   Image = RESULT
  61.  
  62.   Image = bleedit(Image)
  63.  
  64.   'BRIGHTNESS' INFEED '-255' BASE
  65.   XImage = RESULT
  66.  
  67.   'MARK' XImage 'PRIMARY'
  68.   'MARK' Image 'SECONDARY'
  69.   'COMPOSITE' '0 0 ADD'
  70.   OutImage = RESULT
  71.   'CLOSE' Image
  72.   'CLOSE' XImage
  73.   'MARK' OutImage 'PRIMARY'
  74. return OutImage
  75.  
  76. BleedIt:
  77.   parse arg INIMAGE
  78.   'MARK' INIMAGE 'PRIMARY'
  79.   'MARK' INFEED 'ALPHA'
  80.                
  81.   'DISPLACE' 16 trunc(BLEED/4) 'FAST'
  82.   DisplacedImage = RESULT
  83.   
  84.   'CONVOLVE' DisplacedImage '"IE:Convolves/GaussianBlur5x5"'
  85.   NewImage = RESULT
  86.   'CLOSE' DisplacedImage
  87.  
  88.   'MARK' NewImage 'PRIMARY'
  89.   'MARK' INIMAGE 'SECONDARY'
  90.   'COMPOSITE' '0 0 MAX'
  91.   OutImage = RESULT
  92.   'CLOSE' NewImage
  93.   'CLOSE' INIMAGE
  94.  
  95. return OutImage
  96.  
  97. /*******************************************************************/
  98. /* This is where control goes when an error code is returned by IE */
  99. /* It puts up a message saying what happened and on which line     */
  100. /*******************************************************************/
  101. error:
  102. if RC=5 then do            /* Did the user just cancel us? */
  103.     IE_TO_FRONT
  104.     LAST_ERROR
  105.     'REQUEST "'||RESULT||'"'
  106.     exit
  107. end
  108. else do
  109.     IE_TO_FRONT
  110.     LAST_ERROR
  111.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  112.     exit
  113. end
  114.